<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>随手快递</title>
    <link rel="stylesheet" type="text/css" href="../../AUI/css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../font-awesome/css/font-awesome.min.css" />
    <style>
    .ref{
        display: inline-block;
        width: 49%;
        color: #4c4c4c;
    }
        .allow{
            background: #28b0a4;
            color: #fff;
            border-left:1px solid #28b0a4;
        }
    </style>
</head>
<body >
<header class="aui-bar aui-bar-nav" id="aui-header">
    <a class="aui-btn aui-pull-left" tapmode onclick="history.back();">
        <span class="aui-iconfont aui-icon-left"></span>
    </a>
    <div class="aui-title">处理退款请求</div>

</header>
<section class="aui-content" style="margin-top: 46px">
    <div class="aui-card-list">
        <div class="aui-card-list-header aui-card-list-user aui-border-b" >
            <div style="margin-bottom: 8px;">退款原因：</div>
            <ul class="aui-list aui-form-list" style="border: 1px solid #ddd">
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-input"><textarea id="reason" readonly style="height:300px;font-size: 14px;border:0px solid #ddd"></textarea>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    </div>
</section>
<section class="aui-bar aui-bar-tab" >
    <div style="border-top:1px solid #ddd;background: #FFF;height: 45px;line-height: 45px">
            <div class="ref" id="refuse">拒绝退款</div>
            <div class="ref allow" id="allow">允许退款</di>
    </div>
</section>
<script type="text/javascript" src="../../AUI/script/api.js" ></script>
<script src="../../myJs/jquery.js"></script>
<script src="../../myJs/jquery.cookie.js"></script>
<script type="text/javascript" src="../../myJs/index.js" ></script>
<script type="text/javascript">
    apiready = function(){
        api.parseTapmode();
    }
/*     var data = {
        "code":200,
        "msg":{
            "refundReason":"我就是不想要了"
        }
    } */
 	var orderId
        $(function(){
  	orderId = sessionStorage.getItem("orderId");
        $.ajax({
         type: "post",
         url: '/randomdelivery/userManageController/lookRefund',
         data: {
         "orderId": orderId
         },
         datatype: "json",
         success: function (data) {
         alert(JSON.stringify(data));
         $("#reason").val(data.msg.refundReason);
         }
         });
       
    })

    $("#refuse").on("click",function(){
        $.ajax({
         type: "post",
         url: '/randomdelivery/userPurchaseController/acceptRefund',
         data: {
         orderId: orderId,
         refundTemp:0
         },
         datatype: "json",
         success: function (data) {
         alert(JSON.stringify(data));
            location.href='receivedOrder.html';
         }
         });
    })
    $("#allow").on("click",function(){
          $.ajax({
         type: "post",
         url: '/randomdelivery/userPurchaseController/acceptRefund',
         data: {
         orderId: orderId,
         refundTemp:1
         },
         datatype: "json",
         success: function (data) {
         alert(JSON.stringify(data));
         location.href='receivedOrder.html';
         }
         });
    })
</script>
</body>
</html>